import requests

# 请求网址
url = "https://open.bigmodel.cn/api/paas/v4/chat/completions"

# 请求头
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer be5652da760c07a21de7bb18b068172c.9jylW1rT8w8QWp6M"
}

# 接口请求参数
payload = {
    "model": "glm-4",
    "messages": [{"role": "user", "content": "你好"}]
}

# 发送POST请求
response = requests.post(url, headers=headers, json=payload)

# 检查请求是否成功
if response.status_code == 200:
    # 如果成功，打印响应内容
    print("Response content:", response.json())
else:
    print(f"Request failed with status code: {response.status_code}")